package com.smartum.mpr.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

/**
 * @author Walter
 *
 */
public class BackendConfig {

	private static Properties properties;
	private static BackendConfig config;

	static {
		config = new BackendConfig();
	}

	private BackendConfig() {
		try {
			InputStream in = this.getClass().getClassLoader().getResourceAsStream("backend.properties");
			properties = new Properties();
			properties.load(in);
		} catch (IOException ex) {
			Logger.getLogger(BackendConfig.class.getName()).error(ex);
		}
	}

	public static BackendConfig getInstance() {
		return config;
	}

	public String getNewsPhotoDir() {
		return properties.getProperty("news.photo", null);
	}

	public String getItemPhotoDir() {
		return properties.getProperty("item.photo", null);
	}

	public String getAppUrl() {
		return properties.getProperty("store.app.url", null);
	}

	public String getAppFolder() {
		return properties.getProperty("application.folder", null);
	}

	public String getUserPhotoFolder() {
		return properties.getProperty("user.photo", null);
	}

}
